using Microsoft.AspNetCore.Mvc;
using Common.Helper;
using test.Models;

namespace test.Controllers
{
    [ApiController]
    [Route("[controller]")]
    public class JsonController : ControllerBase
    {
        private readonly hongjiContext _db;
        public JsonController(hongjiContext db)
        {
            _db = db;
        }

        [HttpGet(Name = "JsonID")]
        public string Get(int ID)
        {
            string jf = "";
            var Jfile = _db.Jsonfiles.Where(x => x.Id == ID).FirstOrDefault();
            if (Jfile != null)
            {
                jf = Jfile.JsonData;
            }
            return jf;
        }

    }
}